using System;
using System.Collections.Generic;
using System.Text;

namespace Eve.Data
{
    public class Graphic : EveProperty
    {
        private string url3D;
        private string urlWeb;
        private string description;
        private bool published;
        private bool obsolete;
        private string icon;
        private string urlSound;
        private int explosionId;

        private Graphic explosion;

        public string URL3d
        {
            get { return URL3d; }
        }
        public string URLWeb
        {
            get { return urlWeb; }
        }
        public string Description
        {
            get { return description; }
        }
        public bool Published
        {
            get { return published; }
        }
        public bool Obsolete
        {
            get { return obsolete; }
        }
        public string Icon
        {
            get { return icon; }
        }
        public string URLSound
        {
            get { return urlSound; }
        }
        public Graphic Explosion
        {
            get
            {
                if (explosion == null)
                    explosion = new Graphic(db, explosionId);
                return explosion;
            }
        }

        internal Graphic(DbDataRow dr)
            : base(dr.Database, EvePropertyType.Graphic, dr["graphicID"])
        {
            Fill(dr);
        }
        internal Graphic(Database db, int id)
            : base(db, EvePropertyType.Graphic, id)
        {
            Fill(db.ExecuteSingle("SELECT * FROM eveGraphics WHERE graphicID=" + id));
        }

        private void Fill(DbDataRow dr)
        {
            url3D = dr["url3D"];
            urlWeb = dr["urlWeb"];
            description = dr["description"];
            published = dr["published"];
            obsolete = dr["obsolete"];
            icon = dr["icon"];
            urlSound = dr["urlSound"];
            explosionId = dr["explosionID"];
        }
    }
}
